package com.gzhryc.shared_device.cdb.core.protocol.v1.msg;

import com.gzhryc.common.secruity.CRC16;

import java.io.Serializable;

public class CNResponse implements Serializable{
	
	private static final long serialVersionUID = 1L;

	public final static String CMD = "CN";

	private String cmd = CMD;
	private String deviceSn;
	
	public CNResponse() {}
	
	public CNResponse(String deviceSn) {
		this.deviceSn = deviceSn;
	}
	
	public String getCmd() {
		return cmd;
	}

	public void setCmd(String cmd) {
		this.cmd = cmd;
	}

	public String getDeviceSn() {
		return deviceSn;
	}

	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}

	public String getData() {
		String data = cmd+","+deviceSn;
		return data;
	}

	public String getMessage() {
		String data = getData();
		String crc16 = CRC16.get((data+","+ BaseMessage.MESSAGE_KEY).getBytes());
		return "{"+data+","+crc16+"}";
	}

}
